﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace AddressManager.Common.Extension
{
    public static class CollectionExtension
    {
        public static IEnumerable<T> ForEach<T>(this IEnumerable<T> source, Action<T> act)
        {
            foreach (T element in source) act(element);
            return source;
        }

        public static Collection<T> AddAll<T>(this Collection<T> source, IEnumerable<T> entriesToAdd)
        {
            entriesToAdd.ForEach(source.Add);
            return source;
        }        
    }
}